import React, { Component } from 'react'
import ClickCounter from './ClickCounter'

export default class ClickContainer extends Component {

  state={
    showChild : false
  }

  render() {
    return (
      <div style={{padding:'10px',backgroundColor:'#cfc'}}>
        <h3>ClickContainer - 父组件</h3>
        <button onClick={()=>{this.setState({showChild:!this.state.showChild})}}>
          显示隐藏子组件
        </button>
        {this.state.showChild && <ClickCounter abc="xyz"/>}
      </div>
    )
  }
}
